<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>店家页</title>
</head>

<body>
    <div align='center'>
        <h3>点餐页</h3>
        <table border="1" cellspacing="1" style="text-align: center;">
            <th width="200px" style="background:#66ccff;">菜品</th>
            <th width="100px" style="background:#66ccff;">价格</th>
            <th width="50px" style="background:#66ccff;">已售</th>
            <th width="100px" style="background:#66ccff;">状态</th>
            <?php
            if (session_status() == PHP_SESSION_NONE) {
                session_start();
            }
            require_once('db_fns.php');
            $conn = db_connect();
            $mid = $_GET['mid'];
            $sql = "select name from merchant where mid=" . $mid;
            $result = $conn->query($sql);
            while ($row = $result->fetch_array()) {
                $mname = $row['name'];
            }

            $sql = "select * from `merchant_dishes` where `mid`=" . $mid . " order by reced asc, qsold desc";
            $result = $conn->query($sql);
            while ($row = $result->fetch_array()) {
                echo "<tr";
                if ($row['reced'] == 'Y') {
                    echo " style='background:#ffffcc;'";
                }
                echo ">
                <td><a href='do_shop.php?mid=" . $mid . "&did=" . $row['did'] . "'>" . $row['name'] . "</a></td>
                <td>" . $row['price'] . "</td>
                <td>" . $row['qsold'] . "</td>
                <td>" . $row['state'] . "</td>
                </tr>";
            }
            ?>
        </table>
        <a href=cart.php>查看餐车</a>
        <a href=index.php>返回首页</a>
</body>

</html>